<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div>Header</div>
  <div id="app">app</div>
  <div>Footer</div>

  <!-- 引用react -->
  <script src="https://unpkg.com/react@16/umd/react.development.js"></script>
  <script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
  <script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>

  <!-- 使用jsx -->
  <script type="text/babel">
    let message = "Hello React"
    function btnClick() {
      // 当数据发生改变时，需要重新渲染才能改变
      message = "Hello World"
      render()
    }

    function render() {
      ReactDOM.render(
      <div>
        <h2>{message}</h2>
        <button onClick={btnClick}>改变文本</button>
      </div>
      , 
      document.getElementById("app")
      );
    }
    render()
  </script>
</body>
</html>
